package cn.edu.guet.day01;

public class TraditionalThread {

	public static void main(String[] args) {
		Thread thread = new Thread(){
			public void run(){
				while(true){
					try {
						Thread.sleep(500);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					System.out.println(Thread.currentThread().getName());
				}
			}
		};
		thread.start();
		
		//体现面向对象的编程
		Thread thread2 = new Thread(new Runnable(){
			public void run() {	
				while(true){
					try {
						Thread.sleep(500);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					System.out.println(Thread.currentThread().getName());
				}
			}
			
		});
		thread2.start();
	
		new Thread(new Runnable(){

			public void run() {
				while(true){
					try {
						Thread.sleep(500);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					System.out.println("Runnable:"+Thread.currentThread().getName());
				}
			}
			
		}){
			public void run(){
				while(true){
					try {
						Thread.sleep(500);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					System.out.println("Thread:"+Thread.currentThread().getName());
				}
			}
		}.start();
		
	}

}
